package com.wzh.controll;

import com.wzh.pojo.Po.Student;
import com.wzh.service.Stuser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("/student")
public class student {
	@Autowired
	private Stuser stuser;

	@GetMapping("/getstudent")
	@ResponseBody
	public result getstudent(@RequestParam Integer classid){
		System.out.println("classid"+classid);
		List<Student> students = stuser.getstudent(classid);
		String mes=students!=null?"查询成功":"查询失败";
		Integer code=students!=null?200:300;
		return new result(mes,code,students);
	}
	@GetMapping("/deletestudents")
	@ResponseBody
	public String deletestudents(@RequestParam int ids,@RequestParam int classid){

		int res =stuser.deletestudents(ids,classid);
		System.out.println("影响的行数"+res);
        return "SUCCESS";
	}


	//
	@GetMapping("/updatestudent")
	@ResponseBody
	public String updatestudent(@RequestParam("ids") int[] ids ,@RequestParam("classid") int classid){
		int res =stuser.updatestudent(ids,classid);
		return "SUCCESS";
	}

	@GetMapping("/test")
	@ResponseBody
	public String test(@RequestParam int classid){
		System.out.println(classid);

		return "SUCCESS";
	}

}
